#include<bits/stdc++.h>
using namespace std;
int d[100002],v[100002],a[100002],c;
vector<int>p[3002];
int main(){
    freopen("detect.in","r",stdin);
    freopen("detect.out","w",stdout);
    int T;
    scanf("%d",&T);
    while(T--)
    {
        int n,m,L,V;
        scanf("%d%d%d%d",&n,&m,&L,&V);
        for(int i=1;i<=n;i++)
        {
            scanf("%d%d%d",&d[i],&v[i],&a[i]);
        }
        int c;
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&c);
        }
        printf("%d%d",&n,&m);
    }
    fclose(stdin);
    fclose(stdout);
    return 0;
}
